<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="str" uri="/WEB-INF/config/tld/string-util.tld" %>
<jsp:include page="../include/header.jsp" />
<script type="text/javaScript">
<!--
	/* pagination 페이지 링크 function */
	function listPage(){
		$('#viewForm').attr('action', '<c:url value="/task/taskList.do"/>');
		$('#viewForm').submit();
	}
	
	function modifyPage(){
		$('#viewForm').attr('action', '<c:url value="/task/taskWriteForm.do"/>');
		$('#viewForm').submit();
	}
	
	function updateStatusPage(flag){
		$('#sto_flag_yn').val(flag);
		if(flag == "N"){
			if(confirm("삭제하시겠습니까?")){
				$('#viewForm').attr('action', '<c:url value="/task/taskUpdate.do"/>');
				$('#viewForm').submit();
			}
		}else{
			if(confirm("복원하시겠습니까?")){
				$('#viewForm').attr('action', '<c:url value="/task/taskUpdate.do"/>');
				$('#viewForm').submit();
			}
		}
	}
-->
</script>
<!-- contents s -->
	<div class="container" id="container">
		<span class="round lt">&nbsp;</span>
		<span class="round rt">&nbsp;</span>
		<span class="round lb">&nbsp;</span>
		<span class="round rb">&nbsp;</span>
		<div class="container_area">
		<form name="viewForm" id="viewForm" action="<c:url value="/task/taskWriteForm.do"/>" method="post">
			<input type="hidden" name="sto_task_key" id="sto_task_key" value="${resultVO.sto_task_key }"/>
			<input type="hidden" name="sto_flag_yn" id="sto_flag_yn" value="${resultVO.sto_flag_yn }"/>
			<h2 class="tit_h2">목록</h2>
				<jsp:include page="../include/navi.jsp" />
				<c:if test="${loginSessionInfo.admin }">
                <div class="table_wrap">
					<table summary="현장 확인 입니다" class="table_write">
						<caption>현장 확인</caption>
						<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
							<col width="15%" />
							<col width="85%" />
						</colgroup>
						<tbody>
							<tr>
								<th scope="row">현장 확인</th>
								<td class="alL">
									<ul class="check_area_result">
										<c:if test="${not empty resultVO.taskServiceVOList }">
											<c:forEach var="result" items="${resultVO.taskServiceVOList }" varStatus="status">
												<c:if test="${not empty result.sts_task_key }">
													<li>${result.ssa_area_name } <c:if test="${empty result.sts_read_time }">읽지 않음</c:if><c:if test="${not empty result.sts_read_time }">읽음 ${result.sts_read_time }</c:if></li>
												</c:if>
											</c:forEach>
										</c:if>
									</ul>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
					<table summary="업무연락 입니다" class="table_write">
						<caption>업무연락 내용</caption>
						<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
							<col width="15%" />
							<col width="85%" />
						</colgroup>
						<tbody>
							<tr>
								<th scope="row">제목</th>
								<td class="alL">${resultVO.sto_task_title } </td>
							</tr>
                            <tr>
								<th scope="row">첨부파일</th>
								<td class="alL">
									<c:set var="saveFile" value="${fn:split(resultVO.sto_task_file,'**')}" />
									<c:if test="${saveFile[1] != null }">
	                                	<a href="<c:url value='/fileDownload.do'/>?fileInfo=${resultVO.sto_task_file}" onclick="fileDown();return false;" class="file_down ${str:getFileType(saveFile[0])}" >${saveFile[1] }(${saveFile[2]})</a>
                                	</c:if>						
                                </td>
							</tr>
                            <tr>
								<th scope="row">내용</th>
								<td class="alL">${resultVO.sto_task_cont }</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="btn_bbs">
					<a href="<c:url value="/task/taskList.do"/>" onclick="listPage();return false;" class="btn_wh">목록</a>
                    <c:if test="${resultVO.sto_flag_yn eq 'Y'}">
	                    <a href="<c:url value="/task/taskWriteForm.do"/>" onclick="modifyPage();return false;" class="btn_re">수정</a>
	                    <a href="<c:url value="/task/taskUpdate.do"/>" onclick="updateStatusPage('N');return false;" class="btn_gy">삭제</a>
					</c:if>
					<c:if test="${resultVO.sto_flag_yn eq 'N'}">
						<a href="<c:url value="/task/taskUpdate.do"/>" onclick="updateStatusPage('Y');return false;" class="btn_gy">복원</a>
					</c:if>
				</div>
				</c:if>
				<c:if test="${!loginSessionInfo.admin }">
				<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
					<table summary="설비현황 목록" class="table_write">
						<caption>업무연락 내용</caption>
						<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
							<col width="15%" />
							<col width="35%" />
							<col width="15%" />
							<col width="35%" />
						</colgroup>
						<tbody>
							<tr>
								<th scope="row">제목</th>
								<td class="alL" colspan="3">${resultVO.sto_task_title }</td>
								
							</tr>
							<tr>
								<th scope="row">등록일</th>
								<td class="alL">${resultVO.sto_regi_date }</td>
								<th scope="row">첨부파일</th>
								<td class="alL">
                                	<c:set var="saveFile" value="${fn:split(resultVO.sto_task_file,'**')}" />
                                	<c:if test="${saveFile[1] != null }">
                                		<a href="<c:url value='/fileDownload.do'/>?fileInfo=${resultVO.sto_task_file}" onclick="fileDown();return false;" class="file_down ${str:getFileType(saveFile[0])}" >${saveFile[1] }(${saveFile[2]})</a>
                                	</c:if>
                                </td>
							</tr>
							<tr>
								<th scope="row">내용</th>
								<td colspan="3" class="alL">
									<span class="veiw_box">${resultVO.sto_task_cont }
									</span>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="btn_bbs">
					<a href="<c:url value="/task/taskList.do"/>" onclick="listPage();return false;" class="btn_wh">목록</a>
				</div>
				</c:if>
			<!-- 검색조건 유지 -->
			<input type="hidden" name="pageIndex" id="pageIndex" value="${resultVO.pageIndex }"/>
		</form>
		</div><!--//container_area-->
	</div>
	<!-- contents e -->

<jsp:include page="../include/fileDownload.jsp" flush="false">
	<jsp:param name="fileInfo" value="${resultVO.sto_task_file}" />
</jsp:include>
<jsp:include page="../include/footer.jsp" flush="false"/>